<?php
/**
 * 岗位信息
 * Created by PhpStorm.
 * User: echa
 * Date: 2018/3/6
 * Time: 15:41
 */
namespace App\Http\Controllers\WarehouseManage;
use App\Http\Controllers\ApiController;
use App\Services\Orders\OrderService;
use App\Services\Warehouse\ConsignmentNoteService;
use App\Services\Warehouse\JobsService;
use App\Services\Warehouse\OrderGoodsInventoryCarryingDetailService;
use Illuminate\Http\Request;

class JobsController extends ApiController{
    protected $JobsService;
    protected $OrderGoodsInventoryCarryingDetailService;
    protected $OrderService;
    protected $ConsignmentNoteService;
    public function __construct(JobsService $jobsService,OrderGoodsInventoryCarryingDetailService $orderGoodsInventoryCarryingDetailService,OrderService $orderService,ConsignmentNoteService $consignmentNoteService)
    {
        $this->JobsService=$jobsService;
        $this->OrderGoodsInventoryCarryingDetailService=$orderGoodsInventoryCarryingDetailService;
        $this->OrderService=$orderService;
        $this->ConsignmentNoteService=$consignmentNoteService;
    }

    /**
     *  获取岗位信息
    */
    public function GetJobsList(){
        $list=$this->JobsService->ListJobs();
        return $list;
    }

    /**
     *  根据岗位信息编号获取对应岗位详情
    */
    public function  GetJobsInfo(Request $request){
        $FNumber=$request->k3_departments;
        $info=$this->JobsService->InfoJobs($FNumber);
        return $info;
    }

    /**
     *
    */
    public function SubmitOrder(){
        $order=[
            'order_id'=>771404,
            'order_sn'=>'2017121916390882296',
            'wid'=>8,
            'GoodsData'=>[
                [
                    'goods_id'=>989,
                    'goods_sn'=>'0080687504565',
                    'goods_number'=>3,
                    'spec_unit'=>'盒',
                    'best_time'=>'1513686600',
                ]
            ],
        ];
        return $this->OrderGoodsInventoryCarryingDetailService->SubmitOrderGoodsInventoryRequest($order);
    }

    public function test(Request $request){
        //dd(gm_time());
      $order_id=$request->order_id;
      return $this->OrderService->CheckOrderCancelEligible($order_id);
        //$Numbers=$request->numbers;
        //return $this->ConsignmentNoteService->CheckConsignmentNoteStatus($Numbers);
    }
}